

import { axios } from '@/service/service'
import { ListReq, GroupNameReq, IdReq, GroupReq } from './types'

export function queryAlertGroupListPaging(params: ListReq): any {
  return axios({
    url: '/alert-groups',
    method: 'get',
    params
  })
}

export function createAlertGroup(data: GroupReq): any {
  return axios({
    url: '/alert-groups',
    method: 'post',
    data
  })
}

export function listAlertGroupById(): any {
  return axios({
    url: '/alert-groups/list',
    method: 'get'
  })
}

export function queryAlertGroupById(data: IdReq): any {
  return axios({
    url: '/alert-groups/query',
    method: 'post',
    data
  })
}

export function verifyGroupName(params: GroupNameReq): any {
  return axios({
    url: '/alert-groups/verify-name',
    method: 'get',
    params
  })
}

export function updateAlertGroup(data: GroupReq, id: IdReq): any {
  return axios({
    url: `/alert-groups/${id.id}`,
    method: 'put',
    data
  })
}

export function delAlertGroupById(id: IdReq): any {
  return axios({
    url: `/alert-groups/${id.id}`,
    method: 'delete',
    params: id
  })
}
